//
//  StandTableViewCell.m
//  EasyToTesco2.0
//
//  Created by baozi on 16/9/22.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "StandTableViewCell.h"

#define Margin 8

@implementation StandTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self loadFirstCell];
    }
    return self;
}

- (void)loadFirstCell {
    UILabel *firstLabel = [[UILabel alloc] init];
    firstLabel.font = [UIFont systemFontOfSize:14];
    //    firstLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    firstLabel.textAlignment = NSTextAlignmentLeft;
    self.firstLabel = firstLabel;
    [self.contentView addSubview:firstLabel];
    
    
    [firstLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView.mas_left).with.offset(Margin * 2);
        make.height.mas_equalTo(self.contentView.mas_height);
        make.width.mas_equalTo(WIDTH * 0.3);
    }];
    
    UIView *view = [[UIView alloc] init];
    [self.contentView addSubview:view];
    
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.firstLabel.mas_right).with.offset(8);
        make.width.mas_equalTo(WIDTH * 0.6);
        make.height.mas_equalTo(self.mas_height);
        
    }];
    
    UIView *leftView = [[UIView alloc] init];
    leftView.backgroundColor = DEFAULT_COLOR;
    leftView.layer.cornerRadius = 5;
    leftView.layer.masksToBounds = YES;
    [view addSubview:leftView];
    [self.contentView addSubview:leftView];
    
    [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(view.mas_left).with.offset(8);
        make.width.mas_equalTo(10);
        make.height.mas_equalTo(10);
    }];
    
    UILabel *rightLabel = [[UILabel alloc] init];
    rightLabel.text = @"赠送代金券";
    rightLabel.font = [UIFont systemFontOfSize:15];
    rightLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(15.0)];
    [view addSubview:rightLabel];
    [self.contentView addSubview:rightLabel];
    
    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(leftView.mas_right).with.offset(8);
        make.width.mas_equalTo(WIDTH * 0.3);
        make.height.mas_equalTo(10);
    }];

}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
